package com.own.business.system.parameter.base.frame.business.model;

import com.own.business.system.parameter.adapter.base.BaseParameterModel;
import com.own.business.system.parameter.base.frame.entity.po.SystemParameter;
import com.own.business.system.parameter.base.frame.entity.vo.SystemParameterVo;
import io.swagger.v3.oas.annotations.media.Schema;

/**
 * ParameterModel
 *
 * @author chenxueli
 * @date 2023-06-29 09:47:25
 */
public class ParameterModel implements BaseParameterModel {

    @Schema(title = "主键id")
    private final Long id;

    @Schema(title = "系统参数组")
    private final String parameterGroup;

    @Schema(title = "系统参数名称")
    private final String parameterName;

    @Schema(title = "系统参数唯一编号")
    private final String parameterCode;

    @Schema(title = "参数值")
    private final String parameterValue;

    @Schema(title = "生效的环境")
    private final String effectiveEnvironment;

    public ParameterModel(SystemParameter item) {
        this.id = item.getId();
        this.parameterGroup = item.getParameterGroup();
        this.parameterName = item.getParameterName();
        this.parameterCode = item.getParameterCode();
        this.parameterValue = item.getParameterValue();
        this.effectiveEnvironment = item.getEffectiveEnvironment();
    }

    public ParameterModel(SystemParameterVo item) {
        this.id = item.getId();
        this.parameterGroup = item.getParameterGroup();
        this.parameterName = item.getParameterName();
        this.parameterCode = item.getParameterCode();
        this.parameterValue = item.getParameterValue();
        this.effectiveEnvironment = item.getEffectiveEnvironment();
    }

    /**
     * 主键id
     *
     * @return 主键id
     */
    @Override
    public Long getId() {
        return this.id;
    }

    /**
     * 系统参数组
     *
     * @return 系统参数组
     */
    @Override
    public String getGroup() {
        return this.parameterGroup;
    }

    /**
     * 系统参数名称
     *
     * @return 系统参数名称
     */
    @Override
    public String getName() {
        return this.parameterName;
    }

    /**
     * 系统参数唯一编号
     *
     * @return 系统参数唯一编号
     */
    @Override
    public String getCode() {
        return this.parameterCode;
    }

    /**
     * 参数值
     *
     * @return 参数值
     */
    @Override
    public String getValue() {
        return this.parameterValue;
    }

    /**
     * 生效的环境
     *
     * @return 生效的环境
     */
    @Override
    public String getEnvironment() {
        return this.effectiveEnvironment;
    }
}
